﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Quartz;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuartzServiceApp
{
    [DisallowConcurrentExecution]
    public class DoJob : IJob
    {
        private readonly ILogger<DoJob> logger;
        private readonly IConfiguration _config;
        //private readonly ExampleSettings _exampleSettings;

        //public GreetingService(ILogger<GreetingService> log, IConfiguration config, ExampleSettings exampleSettings)
        public DoJob()
        {
            logger = ServiceLocator.Instance.GetService<ILogger<DoJob>>();
            _config = ServiceLocator.Instance.GetService<IConfiguration>();
        }
        async Task IJob.Execute(IJobExecutionContext context)
        {
            logger.LogInformation("hello world ~ ");
            logger.LogError("error");
            logger.LogTrace("trace");

            //Console.WriteLine("hello world ~ ");
            await Task.CompletedTask;
        }
    }
}
